import os
import sys


#dirs = os.listdir(os.getcwd())
#for file in dirs:
#	print(file)

print(sys.argv)
if len(sys.argv)>=2:
    pathName=sys.argv[1]
    #pathName='D:/memo/测试'
    count=0
    if os.path.exists(pathName):
        for root, dirs, files in os.walk(pathName):
            for name in files:
                absPath=os.path.join(root, name)
                absPath=os.path.normpath(absPath)
                #print(absPath)
                file = open(file=absPath, mode='r', encoding='GBK')
                data = file.read()
                count=count+1
                file.close()
        print(count,'个文件转码完成！')
    else:
        print('目录不存在！')
else:
    print('没有输入参数！')
